<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\common\model;

/**
 * 赌王动态模型
 */
class GamblerKingAction extends ModelBase
{
    protected $insert = ['create_time'];

    public function getImageAttr(){
        switch ($this->data['type']){
            case 1:
                return get_picture_url(getConfig('king_action_img1'),false);
                break;
            case 2:
                return get_picture_url(getConfig('king_action_img2'),false);
                break;
            case 3:
                return '';
                break;
            case 4:
                return get_picture_url(getConfig('king_action_img'),false);
                break;
        }

    }

    //关联赌王表
    public function king(){
        return $this->belongsTo('GamblerKing','king_id','id');
    }

    //关联赌王产品表
    public function kinginvestment(){
        return $this->belongsTo('GamblerKingInvestmentUser','user_investment_id','id');
    }

    public function getTypeTextAttr(){
        $arr=['','赌王委托','赌王游戏','赌王分红','新晋赌王'];
       return $arr[$this->data['type']];
    }

    /**
     * 获取信息
     */
    public function getContentJsonAttr($value){

        return json_decode($value,true);
    }

    /**
     * 时间自动完成
     */
    public function setCreateTimeAttr()
    {

        return TIME_NOW;
    }






//
//    public function  getContentAttr($value){
//        $lang=isset($_REQUEST['lang'])?$_REQUEST['lang']:'';
//        return   baidu_translate($value,$lang);
//
//    }
}
